package com.gxa.service.impl.statistical;

import com.gxa.mapper.statistical.ChargeMapper;
import com.gxa.pojo.entity.tjgl.ChargeOverview;
import com.gxa.pojo.entity.tjgl.ChargeSummary;
import com.gxa.pojo.entity.tjgl.util.DateInfo;
import com.gxa.service.statistical.ChargeService;
import com.gxa.utils.MessageCode;
import com.gxa.utils.ResultUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.time.LocalDate;
import java.util.List;

/**
 * @author IKE <hp1041735092@outlook.jp>
 * @date 26/2/2024
 */

@Service
public class ChargeServiceImpl implements ChargeService {
    @Resource
    private ChargeMapper chargeMapper;
    @Override
    public List<ChargeSummary> queryChargeData(String option, DateInfo date) {
        List<ChargeSummary> summary = null;
        switch (option) {
            case "bedArea":
                summary = chargeMapper.queryChargeDataUseBedArea(date);
                break;
            case "operator":
                summary = chargeMapper.queryChargeDataUseOperator(date);
                break;
            case "payWay":
                summary = chargeMapper.queryChargeDataUsePayWay(date);
                break;
            default:
                ResultUtils.buildFail(MessageCode.PARAMETER_ERROR);
                break;
        }
        return summary;
    }

    @Override
    public ChargeOverview queryChargeOverview(LocalDate checkedBeginDate, LocalDate checkedEndDate) {
        return chargeMapper.queryChargeOverview(checkedBeginDate,checkedEndDate);

    }
}
